package org.ssi.web.tags;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

/**
 * <ul>
 * <li>response.addHeader("Pragma", "No-Cache"); </li>
 * <li>response.setHeader("Cache-Control", "no-cache, no-store,
 * must-revalidate");</li>
 * <li>response.addHeader("Cache-Control", "pre-check=0, post-check=0"); </li>
 * <li>response.setDateHeader("Expires", 0);</li>
 * </ul>
 * 
 * @author 
 */
public class NoCacheTag extends SimpleTagSupport {

	public void doTag() throws JspException, IOException {
		PageContext pageContext = (PageContext) this.getJspContext();
		HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
		response.addHeader("Pragma", "No-Cache");
		response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
		response.addHeader("Cache-Control", "pre-check=0, post-check=0");
		response.setDateHeader("Expires", 0);
		super.doTag();
	}

}